<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
<script type="text/javascript">
//数组去重--1
function unique1(arr){
	var newArr=[];
	var len=arr.length;
	for(var i=0;i<len;i++){
		if(newArr.indexOf(arr[i])==-1){
			newArr.push(arr[i]);
		}
	}
	return newArr;

}

console.log(unique1([1,2,3,3,44,2,1,3]))

//数组去重--2
function unique2(arr){
	 return arr.filter(function(item,index){
	 	return arr.indexOf(item)==index;

	})

}

console.log(unique2([1,2,3,3,44,2,1,3]));







</script>
</body>
</html>